package s04;

/**
 * @ClassName GenericInterfaceDemo
 * @Description 测试类
 * @Author Li
 * @Date 2022/8/4 9:13
 * @ModifyDate 2022/8/4 9:13
 * @Version 1.0
 */
public class GenericInterfaceDemo {
    public static void main(String[] args) {
        // 创建对象之前泛型已经确定是String
        MyImpl01 my01 = new MyImpl01();
        my01.show("abc");
        String s1 = my01.getT("张三");
        System.out.println(s1);

        // 创建对象时才能确定泛型的类型
        MyImpl02<String> my02 = new MyImpl02<String>();
        my02.show("def");
        String s2 = my02.getT("李四");
        System.out.println(s2);

        MyImpl02<Integer> my03 = new MyImpl02<Integer>();
        my03.show(123);
        Integer s3 = my03.getT(456);
        System.out.println(s3);
    }
}
